﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DesktopApplication
{
    public partial class AddForm : Form
    {
        public AddForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {           

            string sql = "insert into Articles(Title,Author) values ('" + title.Text + "','" + author.Text + "') ";
            if (DBhelper.AddOrUpdateOrDelete(sql) > 0)
            {
                MessageBox.Show("数据增加成功");
                this.Close();
            }
            else
            {
                MessageBox.Show("数据增加失败");
            }

            }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
